#!/bin/ash

dev=$1
[ "$dev" = "" ] && exit 1
[ ! -b "$dev" ] && exit 1

fs=$(blkid "$dev" | grep -o ' TYPE=".*' | cut -f 2 -d '"')

case $fs in
	ext2|ext3|ext4) e2fsck -y $dev ;;
	vfat|msdos) fsck.fat -y $dev ;;
	exfat) exfatfsck $dev ;;
	*) echo "(${dev}) Not supported: $fs" ; exit 1 ;;
esac

### END ###